#include<bits/stdc++.h>
using namespace std;
char a[100000];
int main()
{
	int t,n,i,j,flag;
	cin>>t;
	for(i=1;i<=t;i++)
	{
		cin>>n;
		flag=1;
		for(j=1;j<=n;j++)
		cin>>a[j];
		for(j=2;j<=n;j++)
		{
			if(a[j]=='1'&&a[j-1]=='1')
			{
				cout<<"No"<<endl;
				flag=0;
				break;
			}
			if(a[j]=='0'&&a[j-1]!='1'&&a[j+1]!='1')
			{
				cout<<"No"<<endl;
				flag=0;
				break;
			}
		}
		if(flag) cout<<"Yes"<<endl;
	}
	return 0;
}
